home *** CD-ROM | disk | FTP | other *** search
- %OP%VS4.11 (04-Dec-91), Gerald Lewis Fitton, R4000 5065 0380 9644
- %OP%DP0
- %OP%IRY
- %OP%PL0
- %OP%HM0
- %OP%FM0
- %OP%BM0
- %OP%LM4
- %OP%FX
- %OP%FY
- %OP%FS
- %OP%PT1
- %OP%PDPipeLine
- %OP%WC834,2070,172,1620,0,0,0,0
- %CO:A,72,72%
- %C%A Simple DataBase - Part 1
- %C%by Gerald L Fitton
- Keywords:
- Beginners Database Fitton
-
- Introduction
- The limitations of Pipedream as a Desk Top Publisher, such as the exact
- positioning of a graphic, really arise because, the screen area is
- divided up into cells so that it can be used as a Spreadsheet. However
- it is these same cells that make it possible to use PipeDream as a
- simple database. It is the use of these cells as the fields of a
- database that I shall describe in this article.
-
- In a series of articles on the PipeLine 3 discs (starting with the
- October 1990 disc) Stephen Gaynor explains exactly what is meant by a
- relational database and describes the limitations of and 'workarounds'
- for PipeDream 3 when using it as a complex database. Generally, to
- understand in depth Stephen's approach you need to get familiar with
- database concepts using something simpler.
-
- On this disc, in the directories DataBase1 and DataBase2 are examples
- of PipeDream used as a simple database. The article in DataBase3
- introduces the use of dependent documents in a 'MultiFile' database.
-
- Files, Records and Fields
- 'MultiFile' databases consist of many files but the simplest of
- databases consist of only one file such as the example [Girls01] in
- this directory. Load this file. It shows a typical database formula
- in the formula line (at the top of the document just to the right of
- the 4 f × and €). You can print out the database file [Girls01],
- preferably using PipeDream printer drivers, and then I suggest that you
- try recreating the database file from the printout using the
- instructions below.
-
- The file has eight 'Records' (numbered 1 to 8 for convenience) but
- could have many more. Each record uses one row in PipeDream and has
- values for every one of five 'Fields'. The five fields are: 'Name',
- 'Hair Colour', 'Eye Colour', 'Character' and 'Favourite Present' for
- each of the eight (fictitious) young ladies.
-
- At this point I should say that I had considered using a file of
- "E-Y-B" ("Eligible Young Bachelors") instead of an "E-Y-L" ("Eligible
- Young Ladies") file but I then I decided I would live dangerously and
- tempt those of you who think this is sexist to write to me, with a
- counter-example for the quarterly discs, showing me how database
- principles can be applied equally to males! Besides which, if I were
- to use an "E-Y-B" file I am not sure what particular characteristics
- E-Y-Ls might wish to store on a database about E-Y-Bs!
-
- Screen Layout
- To make my database fit neatly onto the screen with a small border, I
- have reduced the width of column A to 8 characters (using <Ctrl W>) but
- really, for this example, it isn't necessary; you can use the default
- of 12 characters for all columns.
-
- I have used the mouse to set File - Options - Grid so that the grid
- lines you see on the screen dump separate the cells. Click the menu
- (middle) button of the mouse, run the pointer through Files and then
- through the sub menu Options (or use <Ctrl O> - to use <Ctrl O> you
- must hold down <Ctrl>, then tap <O> and finally release <Ctrl>). Click
- on the small rectangular box just to the right of the word Grid so that
- you get a blue star in the box. When you click on OK or press <Return>
- the grid will appear.
-
- Record Numbers
- An easy way of generating the numbers 1 to 8 in the column A8A15 is to
- use the formula (row - 7) in the column. Start by placing the caret
- in A8, tap F2 (Edit Formula) and type in the formula (row - 7) and tap
- <Return>. At this stage you may have to use <Ctrl LDP> (Layout Decimal
- Places) to set zero decimal places for the numbers so that 1 (in A8)
- appears as 1 and not 1.00. Click the mouse select (left) button to
- place the caret in A8, move the pointer to A15 and tap the mouse
- adjust (right) button to mark the column A8A15. Use the command
- <Ctrl BRD> (Block Replicate Down) to replicate the formula down the
- column (to give the numbers 1 to 8) followed by <Ctrl BSS> (Block
- SnapShot) to change the formulae to fixed numbers.
-
- The Records
- The rectangular block of data, B8F15, is all text and can be typed in
- exactly as shown. The rows are the database records, one record per
- row and one field per column. To move right from column to column
- (field to field) you must tap the <Tab> key. To move left you hold
- down <Shift> whilst you tap <Tab>. To move from row to row you can use
- the <Return> key to move down and the up arrow key to move up. You can
- use the mouse pointer; click the select (left) mouse button with the
- pointer in the cell where you want to caret.
-
- Column Headings
- Row 4 is pure text; type the data in as shown.
-
- The Key Field
- Type the word Name: into A5 and 'Sandy' in B5. You have to imagine
- that the database has hundreds or thousands of records (all with
- different values in the key field - see Stephen Gaynor's article in the
- PipeLine 3 series for the reason why the records must have a unique
- key) so you can't scan your eye down the list of 8 records and pick out
- Sandy immediately. What we are going to do is make the database lookup
- function (see below) find Sandy's record for you.
-
- The Lookup Formulae
- Now we come to the database formulae. Place the caret in C5, tap the
- function key F2 (Edit Function) to enter a formula into C5. Type in
- the lookup formula lookup($B5,$B7$B16,C7C16) and then press <Return>.
- When you press <Return> the word 'Auburn' will appear in the slot C5.
- What has happened is the the lookup function has used the first
- argument of the formula (the value in the cell B5) and found its value
- (which is Sandy). The second argument of the lookup function is a
- range (the values in the column B7B16) and the value 'Sandy' is found
- as the 5th record. The third argument is another range (the values in
- the column C7C16) and the 5th value in this range is 'Auburn' so
- 'Auburn' is the value returned by the lookup function. Summarising
- this, the value of the first argument (Sandy) has been found as the 5th
- value (counting from top to bottom) in the range of cells given by the
- second argument and, because Sandy is the 5th item in this range, the
- function lookup returns the 5th value (counting from top to bottom
- again) in the range given by the third argument.
-
- The next step is to replicate the formula in C5 across the row from C5
- to F5. The quick way is to mark the block C5 to F5, by clicking the
- mouse select (left) button in C5 and the adjust (right) button in F5,
- followed by the command <Ctrl BRR> (Block Replicate Right). The $
- signs in front of the Bs in the formula ensure that the Bs remains
- fixed as Bs in the newly generated formulae; the absence of $s in front
- of the Cs in the third argument ensure that in column D the Cs in the
- formula change to Ds. Similarly the Cs change to Es and Fs for columns
- E and F respectively. For example, the lookup formula in E5 is
- lookup($B5,$B7$B16,E7E16) which finds the value 'Fiery' as the 5th
- value in the range E5E16.
-
- The Title
- Complete the database by typing the title into cell C1 and you can add
- an appropriate comment in C2 if you wish.
-
- Lookup Someone Else's Record
- Place the caret in cell B5 (where you find Sandy), delete Sandy and
- type in Julie instead. The record in row 5 will change from being
- Sandy's record to being Julie's record complete with Brown hair and
- Sports Kit. Try entering a few more of the girls' names in B5 and
- watch the record in row 5 change to match. Generally, at its simplest,
- selecting a record from hundreds or thousands by entering a key is what
- a database is used for.
-
- Put Sandy's name back into B5 before you try the next exercise.
-
- Sorting by Column
- The more astute of you will wonder why (in the lookup function) I have
- used the range of rows from row 7 to row 16 inclusive instead of the
- range from row 8 to 15. The answer is that you can now sort the block
- A8F15 without corrupting the database formulae in C5F5. Let's sort the
- block on column B so that we get the girls' names in alphabetical
- order. Using the mouse, place the caret in A8 and tap the mouse
- select (left) button, then place the caret in F15 and tap the mouse
- adjust (right) button; this will mark the block A8F15. Place the
- caret anywhere in column B (where the girls' names are), use the
- command <Ctrl BSO> (Block SOrt) and you will find yourself with a menu
- called Sort. Although it doesn't matter in this case, if it is
- necessary to do so then click the mouse select (left) button in the
- Multi-row records box so that the star is removed (the blue star should
- be absent by default). Click on the OK box. The whole block will be
- sorted record by record (row by row) and Sandy's record will no longer
- be the 5th but the 7th record between Sally and Sarah. Because neither
- row 7 nor row 16 have moved, the formulae in C5 to F5 remain intact.
-
- If, in the lookup function, you had used the range from row 8 to row 15
- and sorted the database so that either of the rows 8 and 15 moved, then
- the lookup formula would change. If you don't believe me then modify
- the lookup formula in C5 to lookup($B5,$B8$B15,C8C15) and replicate
- right (as before) from C5 to F5, sort on column A (back to the original
- order) and check your formula. Although you still have 'Auburn' in C5
- the formula has changed so that now only part of the database will be
- searched for Sandy. Now try all the girls' names and you will find
- that the lookup command fails with some (but not all) of them. I have
- had dozens of letters from correspondents who have sorted a database or
- spreadsheet and then found that their Sum, Avg, Count, Lookup, etc fail
- to give the correct answer; their problem has been that the argument of
- the function such as Sum(first and last item of a long column) has
- changed during sorting because they have not included two blank rows
- (which are not sorted) as the first and last items in the argument of
- the Sum formula.
-
- Put the formulae back to their original form (with rows 8 and 16)
- before moving on to the next exercise.
-
- Sorting on Two Columns
- If you sort the database by column C then you will find two Blonds,
- Jane and Sarah. To do this sort, mark the block A8F15, place the
- caret in column C and then type in the command <Ctrl BSO>. The Auburn
- haired girl, Sandy, will move up to row 8 with the two blonds in rows
- 11 and 12.
-
- It is not possible to forecast the order of the two blonds (Jane and
- Sarah) from this sort operation; they are not necessarily in
- alphabetical order. However, it is possible during sorting to choose a
- secondary field so that, if the first field (C, the hair colour) has
- equal values then the database is sorted using the secondary field.
- Using this technique you can separate the blue eyed blonds from brown
- eyed blonds! To do this, proceed as before but enter a D into the
- second Sort on column dialogue box. That way you will ensure that blue
- eyed blonds precede brown eyed blonds in the sorted list.
-
- Adding Rows
- Perhaps the simplest way of adding a row is to place the caret
- somewhere in the middle of the data and tap F7 to insert a row. All
- the formulae in row 5 will change to match the enlarged database. Type
- in the data and, if you want to, you can sort the database again on any
- column or (using a secondary key) columns. You can also delete a
- record using F8 to delete a whole row.
-
- Over to You
- In DataBase2 I explain how to use a Master Row for data entry and how
- to use this simple database to enter data into a 'form letter' or mail
- shot. There is nothing like experience so, before you read DataBase2,
- have a go at adding more data or even changing some of the data and see
- what the effect is when you sort the database. What do you think
- happens if you click in the Ascending order box? Try inserting a few
- new rows above the database, for example place the caret in A3 and tap
- the function key F7 and you will see the formulae change so that the
- cell references still pick up the data you want. Add a few lines of
- text. Place the caret anywhere in column A and insert an extra column
- <Ctrl EIC> to its left. All columns in the database move to the right
- (so that what was column A becomes column B etc); every reference in
- all the lookup formulae are updated to match!
-